home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 November / macformat-018.iso / Comms Spectacular / MacHTTP 1.3 / MacHTTP Software / Documentation / AppleEvent & AppleScript Info / Home / stack_-1.xml < prev    next >
Encoding:
Extensible Markup Language  |  1994-04-28  |  2.2 KB  |  20 lines

  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE stack PUBLIC "-//Apple, Inc.//DTD stack V 2.0//EN" "" >
  3. <stack>
  4.     <name>in</name>
  5.     <id>-1</id>
  6.     <cardCount>1</cardCount>
  7.     <cardID>2927</cardID>
  8.     <listID>4006</listID>
  9.     <cantModify><false /></cantModify>
  10.     <cantDelete><false /></cantDelete>
  11.     <cantAbort><false /></cantAbort>
  12.     <cardSize>
  13.         <width>512</width>
  14.         <height>342</height>
  15.     </cardSize>
  16.     <script>--This stack demonstrates how HyperCard can be used with MacHTTP to
  17. --provide searching functions.
  18.  
  19. -- This stack is used by placing a copy of HyperCard 2.1 or greater,
  20. -- (or an alias to the HyperCard applicaiton) named
  21. -- HyperCard.exe in the MacHTTP folder with this stack, named "Home".
  22. -- The URL to access the stack is http://your.address/HyperCard.exe
  23. -- Note that this script doesn't return a properly formatted HTTP/1.0
  24. -- header. See the AppleScript examples for how to do this.
  25.  
  26. on appleEvent class, eventID, sender
  27. put "Handling event!" & sender
  28. if class & eventID is "WWWŒ©srch" then --this is the MacHTTP event code
  29. request ae data
  30. if the result is not empty then
  31. reply "Error -- no data!."
  32. exit appleEvent
  33. end if
  34. put it into searchStr
  35. put it into field "data"
  36. get GlobalWWWSearch(searchStr)  -- process it
  37. reply it  -- send back the reply
  38. else pass appleEvent  -- we don't recognize this event; pass it on
  39. end appleEvent
  40.  
  41. -- A skeleton search function. Notice it returns the search prompt
  42. -- when the searchStr parameter is empty.
  43.  
  44. function GlobalWWWSearch searchStr
  45. if searchStr is empty then
  46. return "<HEAD><ISINDEX><TITLE>Search Documents</TITLE></HEAD>" & ¬¨
  47. "<h1>Enter a single keyword</h1><p>Partial words are OK.<p>"
  48. else
  49. -- get search(searchStr) -- whatever you need to do to searcg is done here
  50. return "<HEAD><TITLE>Search Results</TITLE></HEAD>" & ¬¨
  51. "<H1>Search</H1>The following documents contain " & searchStr & ¬¨
  52. ":<P>" & it & "<P>"
  53. end if
  54. end GlobalWWWSearch
  55.  
  56. on openStack
  57. set the userlevel to 5
  58. pass openStack
  59. end openStack
  60.  
  61. </script>
  62.     <background id="2713" file="background_2713.xml" name="" />
  63.     <card id="2927" file="card_2927.xml" marked="false" name="" owner="2713" />
  64. </stack>
  65.